#include "DistanceVoxel.h"
#include <iostream>

using namespace std;

DistanceVoxel::DistanceVoxel(void)
{
	m_distance = 0.0;
	m_x = 0.0;
	m_y = 0.0;
	m_z = 0.0;
	m_sibling = new DistanceVoxel*[8];
	for(int i = 0; i < 8; i++) {
		m_sibling[i] = 0;
	}
}

DistanceVoxel::DistanceVoxel(float size, float dist, int depth, float x, float y, float z)
{
	m_size = size;
	m_distance = dist;
	m_depth = depth;
	m_x = x;
	m_y = y;
	m_z = z;
	m_sibling = new DistanceVoxel*[8];
	for(int i = 0; i < 8; i++) {
		m_sibling[i] = 0;
	}
	cout << "Created voxel at (" << x << " " << y << " " << z << ") of depth " << depth << " and Distance: " << dist << endl;
}

DistanceVoxel::DistanceVoxel(float size, int depth, float x, float y, float z)
{
	m_size = size;
	m_distance = 0.0;
	m_depth = depth;
	m_x = x;
	m_y = y;
	m_z = z;
	m_sibling = new DistanceVoxel*[8];
	for(int i = 0; i < 8; i++) {
		m_sibling[i] = 0;
	}	
	//cout << "Createx voxel at (" << x << " " << y << " " << z << ") of depth " << depth << endl;
}

DistanceVoxel::~DistanceVoxel(void)
{
	//cout << "DistanceVoxel:: ~"<<endl;
	for(int i = 0; i < 8; i++)
	{
		if(m_sibling[i] != NULL)
		{
			delete m_sibling[i];
		}
	}
	delete[] m_sibling;
}

void DistanceVoxel::setDistance(float dist) {
	//cout << "Created voxel at (" << m_x << "; " << m_y << "; " << m_z << ") of depth " << m_depth << " and Distance: " << dist << endl;
}

int DistanceVoxel::getDepth() {
	return m_depth;
}
